package com.graduate.service.impl;

import com.graduate.mapper.RoleMapper;
import com.graduate.po.Role;
import com.graduate.po.RoleExample;
import com.graduate.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by lx on 2021/02/26.
 */
@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleMapper roleMapper;

    public Role findByid(Integer id) throws Exception {
        return roleMapper.selectByPrimaryKey(id);
    }

    public List<Role> findAll() throws Exception {
        RoleExample example = new RoleExample();
        example.setOrderByClause("roleID desc");
        return roleMapper.selectByExample(example);
    }
}
